package per.qiao.simplerest.restservice;

import per.qiao.simplerest.anno.*;

import java.util.List;

/**
 * Company: 上海数惠系统技术有限公司
 * Department: 数据中心
 * Date: 2020-05-31 15:42
 *
 * @Author: qyp
 * Email: qiaoyp@dist.com.cn
 * Desc:
 */
@RestMapping("simpleRest")
public interface TestService {

    /**
     * GET
     */
    @RestGetMapping("/getMe")
    String getMe(String meg);

    @RestGetMapping("/findById")
    PersonDto findById(Long id);

    @RestGetMapping("/restfulTest/{name}")
    String restfulTest(@RestPathVariable(name = "name") String myName, Integer age);

    @RestGetMapping("/findAll")
    List<PersonDto> findAll();

    /**
     * 这里如果不指定ResponseDto的泛型，那么将会得到 List&lt;LinkedHashMap&gt;
     */
    @RestGetMapping("/findAll2")
    ResponseDto<List<PersonDto>> findAll2();


    /**
     * POST
     */
    @RestPostMapping("/createPerson")
    PersonDto createPerson(@RestRequestBody PersonDto personDto);

    @RestPostMapping("/createPerson2")
    PersonDto createPerson2(@RestRequestBody PersonDto personDto, String msg);

    @RestPostMapping("/createPerson3/{msg}")
    PersonDto createPerson3(@RestRequestBody PersonDto personDto, @RestPathVariable String msg);


    /**
     * PUT
     */
    @RestPutMapping("/updatePerson")
    void updatePerson(@RestRequestBody PersonDto personDto);

    @RestPutMapping("/updatePerson2")
    void updatePerson2(@RestRequestBody PersonDto personDto, String msg);

    @RestPutMapping("/updatePerson3/{msg}")
    void updatePerson3(@RestRequestBody PersonDto personDto, @RestPathVariable String msg);


    /**
     * DELETE
     */
    @RestDeleteMapping("/deleteById/{id}")
    void deleteById(@RestPathVariable Long id);

    @RestDeleteMapping("/deleteById2")
    void deleteById2(Long id);

    @RestDeleteMapping("/deleteByDto")
    void deleteByDto(@RestRequestBody PersonDto personDto);

}
